﻿@using ProjectHopur23.Models;
@model ProjectHopur23.Models.HomeViewModel


<link rel="stylesheet" type="text/css" href="/Content/bootstrap.css" />
<link rel="stylesheet" type="text/javascript" href="/Scripts/bootstrap.js" />
<link rel="stylesheet" type="text/javascript" href="/Scripts/jquery-1.8.2.js" />

   
        <div class="popularGames "> 
            
        <h4 id="popularTitle">Vinsælustu leikirnir</h4>
		@foreach(Game g in Model.popularGames)
		{
			<ul class="olist">
                <li class="list">@g.name</li> 
                <li class="list"><img src="@Url.Content(@g.imageURL)" alt="@g.name" style="height:57px;"/>
                
                 Spilaður @g.timesPlayed sinnum</li>
                <li class="list">
                @Html.ActionLink("Nánar um leik", "GameDescription/" + g.ID.ToString(), "Game", null, new { @class = "btn btn-mini " })
				@Html.ActionLink("Spila leik", "Prepare/" + g.ID.ToString(), "Game", null, new { @class = "btn btn-mini" })</li>
            </ul>
		}
            </div>
            


<div class="modal top">
	@if(HttpContext.Current.Request.IsAuthenticated == true)
	{
		//<p>Hæ @HttpContext.Current.User.Identity.Name !</p>
		if(Model.userInvites.Any() == false)
		{
			<p>Þú hefur engin boð í leiki</p>
		}
		else
		{
			<p>Þú hefur @Model.userInvites.Count() boð</p>
			foreach(InviteFrontViewModel iv in Model.userInvites)
			{
				<div class="inviteBox">
					<p>@iv.hostName býður þér í leik í @iv.gameName. Byrja núna?</p>
					@Html.ActionLink("Já, byrja núna", "Playing/" + iv.activeGameId, iv.gameEngName, null, new { @class = "btn btn-mini " })
					<div class="btn btn-mini"> @Html.ActionLink("Nei, spila seinna", "AcceptInvitation", new {agId = iv.activeGameId, guestId = iv.guestId}, null)</div>
					<div class="btn btn-mini"> @Html.ActionLink("Nei, hef ekki áhuga", "RejectInvitation", "Home", new {agId = iv.activeGameId, guestId = iv.guestId,@class ="btn btn-mini"}, null)</div>
				</div>
			}
		}
	}
</div>

<div class="pendingGames clearfix"> 
    
	<table class="table" >
        <caption class="caption">Leikir sem vantar spilara</caption>
	    <thead>
		<tr class="info">
			<th class="info">Nafn</th>
			<th>Leikur</th>
			<th>Sæti laus</th>
		</tr>
        </thead> 
        <tbody  class="scroll1"> 
    	

	
	
		@foreach(ActiveGameFrontViewModel agv in Model.activeGamesPending)
		{
		<tr class="info">
			<td>@Html.ActionLink(agv.gameNickname, "Playing/" + agv.gameActiveID, agv.gameEngName,null, new { @class = "aSpecial" })</td>
			<td>@agv.gameName</td>
			<td>@agv.currentPlayers / @agv.numberOfPlayers</td>
		</tr>
		}
	</tbody>
</table>
 </div>


<div class="activeGames">
	
    <table class="table">
    <caption class="caption">Leikir í gangi</caption>
	<thead>
	<tr class="info">
		<th>Nafn</th>
		<th>Leikur</th>
		<th>Sæti laus</th>
	 </tr>
	</thead>
    
     
	<tbody class="scroll1">
        
		@foreach(ActiveGameFrontViewModel agv in Model.activeGamesFull)
		{   
		<tr class="info">
			<td>@Html.ActionLink(agv.gameNickname, "Playing/" + agv.gameActiveID, agv.gameEngName,null, new { @class = "aSpecial" })</td>
			<td>@agv.gameName</td>
			<td>@agv.currentPlayers / @agv.numberOfPlayers</td>
		</tr>
		}

	</tbody>
	</table>
   
   
</div>

<div class="scores"> 
   
	<div class="listHighScores">
		<table class="table">
        <caption class="caption">Stigatafla</caption>
		<thead>
			<tr class="info">
				<th>#</th>
				<th>Nafn</th>
				<th>Stig</th>
			</tr>
		</thead>
		<tbody class="scroll1">
		@{
			int num = 0;
			foreach(HighScoreViewModel hs in Model.highScores)
			{
				num++;
				<tr class="info">
					<td>@num</td>
					<td>@hs.name</td>
					<td>@hs.score</td>
				</tr>
			}
		}
		</tbody>
      </table>
	</div>
</div>

<div class="onlineUsers">
    
    
	<table class="tablemin">
        <caption class="caption">Innskráðir notendur</caption>
			<thead>
                <tr>
                <th>#</th>
                <th>Nafn</th>
			</thead>
            
		<tbody class="scroll2 ">
		@{
			int number = 0;
			foreach(var ou in Model.onlineUsers)
			{
                number++;
				<tr class="info">
				<td>@number</td>
				<td>@ou</td>
                
                    
				</tr>
			}
		}
           
		</tbody>
	</table>
     </div>



